Populate windowMinutes for Zai, Kimi, Grok, and Antigravity rate windows (#2431) - #2514
Populate windowMinutes for Zai, Kimi, Grok, and Antigravity rate windows (#2431)#2514Yuxin-Qiao wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1123bfccce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| primary = RateWindow( | ||
| usedPercent: percent, | ||
| windowMinutes: nil, | ||
| windowMinutes: ProviderPaceCapability.monthlyWindowSentinelMinutes, |
There was a problem hiding this comment.
Preserve reset-based cadence for Grok web billing
For every Grok web-billing snapshot, this hard-codes a monthly duration even though the web response can represent weekly periods and exposes only resetsAt. GrokProviderDescriptor.primaryLabel(window:now:) prioritizes windowMinutes, so a weekly web period is now labeled Monthly and excluded from the descriptor's weekly pace calculation; this also contradicts the existing web-snapshot test that expects the unknown duration to remain nil. Keep the duration unset or derive it from the reset timestamp before assigning a sentinel.
Useful? React with 👍 / 👎.
| let windowMinutes: Int? = if let desc = quota.resetDescription?.lowercased() { | ||
| if desc.contains("weekly") || desc.contains("7-day") || desc.contains("7d") { | ||
| 10080 | ||
| } else if desc.contains("session") || desc.contains("5h") || desc.contains("5-hour") || desc | ||
| .contains("five hour") |
There was a problem hiding this comment.
Derive Antigravity cadence from production fields
These aliases are not present in the model-quota data produced by any production fetch path: remote fetches set resetDescription through UsageFormatter.resetDescription, which yields a clock time, “tomorrow,” or an absolute date, while the local command-model parser sets it to nil. Consequently legacy Antigravity snapshots still emit nil windowMinutes, and the new test passes only because it constructs descriptions that the parsers never produce. Derive cadence from stable quota/model metadata rather than the display-formatted reset string.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 1:45 AM ET / 05:45 UTC. ClawSweeper reviewWhat this changesThe branch assigns verified rate-window durations for Z.ai, Kimi, and Antigravity provider quotas, keeps Grok web-billing cadence unknown when it cannot be verified, and adds focused regression tests. Merge readiness⛔ Blocked until real behavior proof is added - 8 items remain This PR should stay open, but it is not mergeable in its current form: the final diff still contains an unrelated embedded worktree with millions of added lines alongside the intended provider-window fix. The earlier cadence findings appear addressed in the PR description and follow-up commits; the remaining blockers are removing that unrelated tree and posting redacted after-fix live behavior proof. Priority: P2 Review scores
Verification
How this fits togetherCodexBar provider adapters convert provider-specific quota responses into shared rate windows. The shared pace and forecast engine consumes each window’s percentage, reset time, and duration to calculate usage projections for the app. flowchart LR
A[Provider quota responses] --> B[Provider adapters]
B --> C[Rate windows]
C --> D[Pace and forecast engine]
D --> E[Usage cards and forecasts]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land a fresh, focused provider-only diff that removes every Do we have a high-confidence way to reproduce the issue? No high-confidence current-main live reproduction is included. The report, branch fixtures, and focused tests identify the parsing path, but the PR explicitly lacks redacted after-fix provider or app/CLI output. Is this the best way to solve the issue? No. The provider-adapter approach is appropriately narrow after the cadence fixes, but the current branch is not a maintainable delivery vehicle because it retains an unrelated embedded repository and has no real after-fix proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8ef86077e70a. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review We have addressed your review comments in commit 1. Grok Web Billing Cadence
2. Antigravity Model Quotas (
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 506596711b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for token in normalized.components(separatedBy: CharacterSet(charactersIn: " -/")) where !token.isEmpty { | ||
| candidates.insert(token) |
There was a problem hiding this comment.
Strip punctuation before matching cadence aliases
When cadence appears in a parenthesized model label such as the newly added Gemini 2.5 Pro (Weekly) or Claude 3.5 Sonnet (5-hour session) fixtures, this split produces tokens like (weekly) and session), neither of which matches the alias sets. Both windows therefore retain a nil windowMinutes, so the new label-fallback test fails and the intended fallback does not work; normalize punctuation or tokenize on non-alphanumeric boundaries before matching.
Useful? React with 👍 / 👎.
…te#2431) - Keep Grok web billing windowMinutes nil instead of deriving a full cadence from the remaining time until reset - Split Antigravity cadence candidates on non-alphanumeric boundaries so parenthesized labels like (Weekly) and (5-hour session) match - Add regression for a monthly Grok reset near its end Co-authored-by: Cursor <cursoragent@cursor.com>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
💡 Codex ReviewCodexBar/Sources/CodexBarCore/Providers/Zai/ZaiUsageStats.swift Lines 227 to 230 in 3ca5e91 When the API returns a When cadence is embedded using one of the newly declared compound aliases, such as ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…#2431) MiMo's monthly token quota and StepFun's monthly credit pool built their primary RateWindow with windowMinutes = nil, so `planUtilizationSeriesSamples` skipped them — meaning those cards get neither the plan-utilization history chart nor the predictive pace forecast that Codex/Claude cards show. This brings them to parity, mirroring steipete#2514 (which did the same for Zai/Kimi/Grok/ Antigravity). - MiMo: token window carries `monthlyWindowSentinelMinutes` when `planPeriodEnd` is present (a real reset to project against); nil otherwise. - StepFun: the credit window carries it when `creditResetTime` is present. Verified live: a StepFun credit-plan account now reports the credit window with windowMinutes 43200 (reset ~1 month out). Tests cover both providers, including the no-reset case that keeps windowMinutes nil. Refs steipete#2431.
…pound aliases (steipete#2514) Z.ai: When a TIME_LIMIT has an explicit duration (e.g. 5 hours), preserve the parsed windowMinutes instead of always reporting the 30-day monthly sentinel. The monthly sentinel is now only applied to MCP monthly markers and time limits without explicit durations. Antigravity: Extend compound cadence alias matching to handle labels like "7-day limit" and "five-hour session" by checking both exact matches and hyphenated suffix patterns after stripping " limit" suffixes. Add regression tests for: - Z.ai time limit with explicit duration preserves windowMinutes - Z.ai time limit without duration falls back to monthly sentinel - Antigravity compound aliases in resetDescription ("7-day limit", "five-hour session") - Antigravity compound aliases in hyphenated modelId ("gemini-pro-7-day", "claude-sonnet-five-hour") Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@codex The two P2 issues have been addressed:
Please re-review. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19708f1567
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,202 @@ | |||
| // swift-tools-version: 6.2 | |||
There was a problem hiding this comment.
Remove the checked-in worktree copies
Merging this commit adds the entire .worktrees directory: repo-wide inspection finds 18,871 paths across nine complete checkout copies, including generated .tmp-clang-module-cache artifacts, totaling roughly 512 MB and 4.8 million added lines. This permanently inflates every clone and checkout and makes repository-wide tooling scan several stale copies of the project; retain only the eight intended provider/test files and exclude .worktrees from the commit.
AGENTS.md reference: .worktrees/dashboard-token-tests/AGENTS.md:L29-L31
Useful? React with 👍 / 👎.
Summary
Several provider fetchers omit
windowMinuteswhen constructingRateWindowinstances, which causes the pace calculation and usage forecast engine to silently disable itself for those providers.This PR populates
windowMinutesfor:ZaiUsageStats.swift): PopulateProviderPaceCapability.monthlyWindowSentinelMinutes(43,200) fortimeLimitandisMCPMonthlyMarkerrate windows.KimiUsageSnapshot.swift): PopulateProviderPaceCapability.monthlyWindowSentinelMinutes(43,200) formonthlyWindowsubscription rate windows.AntigravityStatusProbe.swift): DerivewindowMinutes(300 for session windows, 10,080 for weekly windows) frommodelId,label, andresetDescriptioninrateWindow(for quota:).GrokStatusProbe.swift): Explicitly keepwindowMinutesasnilfor web billing rate windows; the remaining time until reset is not a verified full-period boundary, so inferring a cadence from it can misclassify a monthly window as weekly.Review follow-ups
Gemini 2.5 Pro (Weekly)andClaude 3.5 Sonnet (5-hour session)correctly match the session/weekly cadence aliases.TIME_LIMITentries with explicit durations (e.g. 5 hours) now preserve the parsedwindowMinutesinstead of being forced to the 30-day monthly sentinel. The monthly sentinel is only applied to MCP monthly markers and time limits without explicit durations."7-day limit"and"five-hour session", and in hyphenated model IDs like"gemini-pro-7-day"and"claude-sonnet-five-hour".Verification
swift test --filter AntigravityWindowMinutesTests✅swift test --filter GrokWebBillingFetcherTests✅swift test --filter KimiProviderTests✅swift test --filter ZaiProviderTests✅swift test --filter "AntigravityWindowMinutesTests|GrokWebBillingFetcherTests|KimiProviderTests|ZaiProviderTests"✅ (150+/150+)swiftformat Sources Tests✅swiftlint --strict✅ (0 violations)Proof notes
"7-day limit","five-hour session","gemini-pro-7-day", and"claude-sonnet-five-hour"correctly resolve to weekly/session windows.Fixes #2431